﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NLBS.Data;
using NLBS.Framework;

namespace NLBS.Control
{

    [DefaultProperty("Text")]
    [ToolboxData("<{0}:PanelLink runat=server></{0}:PanelLink>")]
    public class PanelLink : PanelModule
    {
        [TemplateContainer(typeof(DefaultLinkTemplate))]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        public override ITemplate ItemTemplate
        {
            get
            {
                return base.ItemTemplate;
            }
            set
            {
                base.ItemTemplate = value;
            }
        }

        public override string Title
        {
            get
            {
                return lang["links"];
            }
            set
            {
                base.Title = value;
            }
        }

        protected override void CreateChildControls()
        {
            if (ItemTemplate == null)
                ItemTemplate = new DefaultLinkTemplate();
            base.CreateChildControls();
        }
    }

    public class DefaultLinkTemplate : ITemplate
    {
        public void InstantiateIn(System.Web.UI.Control container)
        {

            container.Controls.Add(new LiteralControl(SiteConfig.GetLinks("FriendLink")));
        }
    }
}
